package com.iona.servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.iona.dao.PurposesDAO;
import com.iona.domain.Purposes;
import com.iona.json.JSONException;
import com.iona.json.builders.PurposesBuilder;

/**
 * Servlet implementation class PurposesFeederServlet
 */
@WebServlet("/PurposesFeederServlet")
public class PurposesFeederServlet extends FeederServlet implements Servlet {
	private static final long serialVersionUID = 1L;


	@Override
	public Object doFeed(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException,
			JSONException {
		List<Purposes> findAll = new PurposesDAO().findAll();
		return new PurposesBuilder(findAll).build();
	}

}
